package com.qf.ssm.controller;

import com.qf.ssm.entity.order.EvluationReply;
import com.qf.ssm.entity.order.OrderReview;
import com.qf.ssm.service.EvalManageService;
import com.qf.ssm.utils.ResponseResult;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.security.PrivateKey;
import java.util.List;

/**
 * @author hzy
 * @DATE 2021/2/26
 */
@RestController
@RequestMapping("/orderReview")
public class OrderReviewController {
    @Resource
    EvalManageService manageService;

    /*
    * 查看所有商品评论
    * */
    @GetMapping("/review/list")
    private ResponseResult<List<OrderReview>>queryReviewList(){
        ResponseResult<List<OrderReview>> result = manageService.selectEvalList();
        return result;
    }
    /*
    * 根据商品编号查询对应评论
    * */
    @GetMapping("/review/numbers")
    private ResponseResult<OrderReview>queryReviewByOrderNums(String orderNums){
        ResponseResult<OrderReview> result = manageService.selectEvalByNumbs(orderNums);
        return result;
    }
    /*
    * 根据商品名字信息查询对应的评论
    *
    * */
    @GetMapping("/review/goodsmessage")
    private ResponseResult<List<OrderReview>>queryReviewByGoodsMessage(String goodsMessage){
        return manageService.selectEvalByMessage(goodsMessage);
    }

    /*
    * 评论回复
    * */
    @PutMapping("/seller/Reply")
    private ResponseResult<Integer>updateReviewReply(EvluationReply evluationReply){
        return manageService.OrderReviewAudit(evluationReply);
    }

    /*
    * 修改评论回复*/

    @PutMapping("seller/modifyReply")
    private ResponseResult<Integer>modifyReviewReply(EvluationReply evluationReply){
        return manageService.OrderReviewMofidyByorId(evluationReply);
    }

    /*
    * 买家增加评价
    *
    * */
    @PostMapping("/buyer/review")
    private ResponseResult<Integer>addBuyerReview(OrderReview orderReview){
        return manageService.insertBuyerReview(orderReview);
    }

    /*
    * 卖家后台评论查看是否展示，假删除
    * */
    @GetMapping("/seller/delete")
    private ResponseResult sellerDeletereview(@RequestParam Integer orid,@RequestParam Integer status){
        return manageService.updateStatusByorID(orid,status);
    }



}
